#ifndef RTP_PARSE_FEEDBACK_PS_REMB_H
#define RTP_PARSE_FEEDBACK_PS_REMB_H

#include "rtp/FeedbackPsAfb.h"

namespace Rtp {
    namespace Rtcp {
        class FeedbackPsRembPacket: public FeedbackPsAfbPacket {
        public:
            static const uint32_t UniqueIdentifier { 0x52454D42 };
            static const size_t UniqueIdentifierSize { 4 };

        public:
            static FeedbackPsRembPacket* Parse(const uint8_t* data, size_t len);
        public:
            FeedbackPsRembPacket(uint32_t senderSsrc, uint32_t mediaSsrc): FeedbackPsAfbPacket(senderSsrc, mediaSsrc, FeedbackPsAfbPacket::Application::REMB) {}
            FeedbackPsRembPacket(CommonHeader *commonHeader, size_t availableLen);
            ~FeedbackPsRembPacket() override = default;

            bool IsCorrect() const {
                return this->isCorrect;
            }

            void SetBitrate(uint64_t bitrate) {
                this->bitrate = bitrate;
            }

            void SetSsrc(const std::vector<uint32_t>& ssrcs) {
                this->ssrcs = ssrcs;
            }

            uint64_t GetBitrate() {
                return this->bitrate;
            }

            const std::vector<uint32_t>& GetSsrcs() {
                return this->ssrcs;
            }
        public:
            void Dump() const override;
            size_t Serialize( uint8_t* buffer) override;
            size_t GetSize() const override {
                return FeedbackPsPacket::GetSize() + 8 + (4u * this->ssrcs.size());
            }
        private:
            std::vector<uint32_t> ssrcs;
            uint64_t bitrate { 0 };
            bool isCorrect { true };
        };
    }
}
#endif